<?php echo Modules::run('content/header_content') ?>    
   
	<div class="container main">
    
        <div class="row">
        <?php foreach ($store as $val) { ?>
		  <div class="span5 sidebar">
            <div class="box box-pad2">
              <div class="shop-profile">
                <div class="pull-right">
                </div>
                
                <div class="shop-profile-img">
                <?php if($val->logo == NULL){ ?>
                  <img width="48" height="48" src="<?php echo base_url('assets/img/no-image-100x100.png') ?>" title="No Image"/>
                <?php }else{ ?>
                  <img width="48" height="48" src="<?php echo base_url('data/thumb/'.$val->logo) ?>" title="<?php echo $val->nama_toko ?>" alt="<?php echo $val->nama_toko ?>">
                <?php } ?>
                </div>
                
                <div class="shop-profile-name clearfix">
                  <div>
                    <a href="<?php echo base_url('store/lists/'.$val->toko_id) ?>" title="<?php echo $val->nama_toko ?>">
                      <?php echo $val->nama_toko ?>
                    </a>
                  </div>
                </div>
                <div class="shop-profile-desc ">
                  <?php echo $val->description ?>                                  
                </div>
              </div>
              <div class="shop-profile">
                <div>
                  <?php echo $val->alamat ?>
                </div>
                <div>
                </div>
                <div>
                  <?php echo $val->kota ?>, <?php echo $val->provinsi ?> <?php echo $val->kode_pos ?>
                </div>
                <div>
                  <?php echo $val->negara ?>
                </div>
                <div>
                  Telp : <?php echo $val->telepon ?>
                </div>
                <div>
                  Hp : <?php echo $val->hp ?>
                </div>
              </div>
              <div class="shop-profile">
                <h4>
                  New Products
                </h4>
                <div class="shop-profile-slide clearfix">
                  <ul>
                  <?php $latest = $this->product_model->get_latest_by_store($val->toko_id); ?>
                  <?php foreach ($latest as $keys => $lat ) { ?>
                    <li>
                    
                      <a href="<?php echo site_url('product/detail/'.$lat->product_seo_name); ?>">
                      <?php if($lat->image_file == NULL) {?>
                        <img width="48" height="48" src="<?php echo base_url('assets/img/no-image-100x100.png') ?>" title="No Image"/>
                      <?php }else{ ?>
                        <img width="48" height="48" src="<?php echo base_url('data/thumb/'.$lat->image_file) ?>" title="<?php echo $lat->product_name ?>" alt="<?php echo $lat->product_name ?> Rp <?php echo number_format($lat->price,2,',','.'); ?>">
                      <?php } ?>
                      </a>
                      
                    </li>
                  <?php } ?>
                  </ul>
                </div>
              </div>
            </div>
            <!--<div class="box box-pad2 collection">
              <h2>
                Koleksi
              </h2>
              <ul>
                <li>
                  <a href="#">
                    <img src="<?php echo base_url('assets/img/no-image-100x100.png') ?>" width="48" height="48" alt="Lorem lipsum dolor sit." title="Lorem lipsum dolor sit.">Lorem lipsum dolor sit.
                  </a>
                </li>
              </ul>
            </div>-->
          </div>
          
          <?php } ?>
		
          <div class="span10 content" style="overflow: hidden;">
            <div class="box box-pad">
              <div class="container">
                <div class="row">
                  <div class="span10">
                    <ul class="breadcrumb">
                      <li>
                        <a href="<?php echo base_url(); ?>">
                          Home
                        </a>
                      </li>

                      <?php if (count($detail) == 1): ?>
                      <?php foreach ($detail as $val) { ?>
                      <li>

                        <span class="divider">
                          /
                        </span>
                       	<?php $cat = $this->product_model->get_category($val->category_id) ?>
                        <?php $parent = $this->product_model->get_category_parent($cat->category_id) ?>

            				    <?php if($cat->parent == 0){}else{ ?>
            				    <a href="<?php echo base_url('category/lists/'.$parent->category_id); ?>">
								          <?php echo $parent->category_name; ?>
            				    </a>
           
                        </li>
                        <li class="active">
                          <span class="divider">
                            /
                          </span>
                          <?php } ?>
                          <?php $child = $this->product_model->get_category_child($val->category_id) ?>
                          <a href="<?php echo base_url('category/lists/'.$child->category_id); ?>">
                            	<?php echo $child->category_name; ?>
                          </a>
                        </li>
                      <?php } ?>
                      <?php endif; ?>

                    </ul>
                  </div>
                </div>
              </div>
              
              <?php if (count($detail) == 1): ?>

              <?php foreach ($detail as $val): ?>

              <?php $currency = $this->currency->getCurrency();?>
              <div class="container">
                <div class="row">
                  <div class="span4">
                    <div class="detail-left">
                      <div class="zoom-small-image">
                        <div id="wrap">
                          <!--<a href="<?php echo base_url('data/upload/'.$val->image_file) ?>">-->
                          <?php if($val->image_file == NULL) {?>
                            <img style="padding:10px;" src="<?php echo base_url('assets/img/no-image-100x100.png') ?>" title="No Image"/>
                          <?php }else{ ?>
                            <img id="zoom" src="<?php echo base_url('data/thumb/'.$val->image_file) ?>" data-zoom-image="<?php echo base_url('data/upload/'.$val->image_file) ?>">
                          <?php } ?>
                          <!--</a>-->
                          <div class="mousetrap">
                          </div>
                        </div>
                      </div>
                      
                      <!--<h5>
                        Bayar dengan:
                      </h5>
                      <p class="paywith">
                        <a href="#">Lorem lipsum dolor sit.</a>
                        <a href="#">Lorem lipsum dolor sit.</a>
                        <a href="#">Lorem lipsum dolor sit.</a>
                        <a href="#">Lorem lipsum dolor sit.</a>
                        <a href="#">Lorem lipsum dolor sit.</a>
                      </p>

                      <h5>
                        Pengiriman:
                      </h5>
                      <ul>
                        <li>
                          Lorem lipsum dolor sit.
                        </li>
                      </ul>
                      -->
                    </div>
                  </div>
                  <div class="span6">
                    <div class="detail-right">
                      <h1><?php echo $val->product_name; ?></h1>
                      <p class="price">
                        <b> 
                        <?php echo $this->currency->format($val->price, $currency); ?>
                        </b>
                      </p>
                     
                     
                     <?php $option = $this->product_model->get_option_by_product($val->product_id); ?>
                     <?php if (isset($option)): ?>
                      <h5>Avalaible Option </h5>
                      <div id="product-option"> 
                        <label class="control-label" for="product_option_id"></label>
                        <select style="width:173px;" id="product_option" class="product_option" name="product_option_id">
                            <option value="">-- Select --</option>
                            <?php foreach ($option as $opt) { ?>
                                <option value =<?php echo $opt->product_option_id ?>> 
                                    <?php echo $opt->option_value ?> (<?php echo $this->currency->format($opt->price, $currency); ?>) </option>
                            <?php } ?>
                        </select>
                      </div>
                    <?php endif; ?>
                      

                      <form id="add_product" name="add_product" action="" method="POST">
                        <!--<input id="store_id" name="store_id" type="hidden" value="c4OwMGYsBX">
                        <input id="product_id" name="product_id" type="hidden" value="e50zAvmLFr">
                        <div id="productOption">
                        </div>
                        -->
                        <div id="productQuantity"> 
                          <input id="quantity_<?php echo $val->product_id; ?>" class="quantity span3" name="quantity" type="number" min="1" value="1">
                        </div>
                        <p>
                          <a class="add_cart" data-product="<?php echo $val->product_id; ?>">Add to Cart</a>
                        </p>
                      </form>

                      <?php if ($val->subtract_stock == 1): ?>
                        <?php if($val->quantity == 0): ?>
                          <div class="modal-header">
                            <h3>
                              Persediaan habis
                            </h3>
                          </div>
                        <?php else: ?>
                          <div class="modal-header">
                            <h3>
                              Stok : <span id="stok"><?php echo $val->quantity; ?></span>
                            </h3>
                          </div>
                        <?php endif; ?>
                      <?php endif; ?>

                      <div class="tags-desc">
                        
                        <!--<h5 class="tags">
                          Tag
                        </h5>
                        <ul class="tags clearfix">
                          <li>
                            <a href="<?php echo $val->tags ?>"><?php echo $val->tags ?></a>
                          </li>
                        </ul>-->

                        <h5>
                          Deskripsi
                        </h5>
                        <div>
                          <?php echo $val->description; ?>
                        </div>
                      </div>

                    </div>
                  </div>
                </div>
				
              <?php endforeach; ?>

              <?php else: ?>

              <div class="container">
                <div class="row">
                  <div class="span10 content">
                  <h1 style="padding: 0 15px;">Product Not Found!</h1>
                  </div>
                </div>
              </div>

              <?php endif; ?>

              </div>
            </div>
          </div>
          

        </div>
        
<script>
$(window).load(function() {
    $("#zoom").elevateZoom();
});

</script>

<?php echo Modules::run('content/footer_content') ?>